<!DOCTYPE html>

<html>
<head>
  <title>Language &hArr; Language Matrix</title>
  <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css" rel="stylesheet">
  <style>
  td { font-size: 0.8em; }
  td.yay { padding: 0; background: #8f8 !important; }
  td.yay a { display: block; padding: 8px; font-weight: bold; background: #8f8; }
  td.yay a.runtime { background: #bf8; }
  td.yay a.sourcesource { background: #8fb; }
  td.na { background: #ddd !important; }
  td.no { text-align: center; }
  .desc { margin-right: 100px; font-size: 1.2em; margin-top: 16px;  }
  .hover { background: #def; }
  #myideaoffun { font-size: 20px; padding: 8px 0; line-height: 1.4; height: 100px; }
  </style>
</head>
<body>
  <a href="https://github.com/tcr/langlangmatrix"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png" alt="Fork me on GitHub"></a>

  <div class="container-fluid">
    <h1>The Language &hArr; Language Matrix</h1>
    <p class="desc"><b>Languages running in other languages!</b> Source-to-source compilers, interpreters, and bytecode compilers. None of these projects are vetted/assured to be complete. <a href="https://github.com/tcr/langlangmatrix/pulls">Submit your own link or add corrections.</a> Maintained by <a href="https://github.com/tcr">Tim Cameron Ryan</a>.</p>
    <p id="myideaoffun"></p>

    <table class="table table-bordered" id="matrix">
      <tr class="heading first-heading">
        <th rowspan="15">Source</th>
        <th colspan="15" style="text-align: center">Target</th>
      </tr>
      <tr class="heading">
        <th>&nbsp;</th>
        <th>JavaScript<sup><a href="https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS">[1]</a></sup></th>
        <th>C/C++</th>
        <th>Java</th>
        <th>Ruby</th>
        <th>PHP</th>
        <th>Scala</th>
        <th>C#</th>
        <th>Clojure</th>
        <th>Python</th>
        <th>Lua</th>
        <th>Haskell</th>
        <th>OCaml</th>
      </tr>

      <tr>
        <th>JavaScript</th>
        <td class="yay">
          <a href="http://benvie.github.com/continuum">Continuum</a>
          <a href="https://github.com/mozilla/narcissus">Narcissus</a>
          <a href="http://wthimbleby.github.io/tailspin">Tailspin</a>
        </td>
        <td class="yay"><a href="http://github.com/tcr/gum">Gum</a></td>
        <td class="yay">
          <a href="https://developer.mozilla.org/en-US/docs/Rhino" class="runtime">Rhino</a>
          <a href="http://dynjs.org/">dynjs</a>
          <a href="http://github.com/tcr/mug">Mug</a>
        </td>
        <td class="yay">
          <a href="http://web.archive.org/web/20100201180650/http://tenderlovemaking.com/2007/04/15/converting-javascript-to-ruby-with-rkelly/">RKelly</a>
        </td>
        <td class="yay">
          <a href="http://include-once.org/p/phpjs/">phpjs</a>
        </td>
        <td class="yay"><a href="https://github.com/js-scala/js-scala">js.scala</a></td>
        <td class="no">N/A</td> <!--Javascript via C#-->
        <td class="no">N/A</td> <!--Javascript via Clojure-->
        <td class="no">N/A</td> <!--Javascript via Python-->
        <td class="no">N/A</td> <!--Javascript via Lua-->
        <td class="no">N/A</td> <!--Javascript via Haskell-->
        <td class="no">N/A</td> <!--Javascript via OCaml-->
      </tr>
      <tr>
        <th>C/C++</th>
        <td class="yay"><a href="http://emscripten.org/">Emscripten</a></td>
        <td class="no">N/A</td> <!--C/C++ via C/C++-->
        <td class="no">N/A</td> <!--C/C++ via Java-->
        <td class="no">N/A</td> <!--C/C++ via Ruby-->
        <td class="no">N/A</td> <!--C/C++ via PHP-->
        <td class="no">N/A</td> <!--C/C++ via Scala-->
        <td class="no">N/A</td> <!--C/C++ via C#-->
        <td class="no">N/A</td> <!--C/C++ via Clojure-->
        <td class="no">N/A</td> <!--C/C++ via Python-->
        <td class="no">N/A</td> <!--C/C++ via Lua-->
        <td class="no">N/A</td> <!--C/C++ via Haskell-->
        <td class="no">N/A</td> <!--C/C++ via OCaml-->
      </tr>
      <tr>
        <th>Java</th>
        <td class="yay">
          <a href="http://int3.github.io/doppio/about.html">Doppio</a>
          <a href="http://code.google.com/webtoolkit/">Google Web Toolkit (GWT)</a>
          <a href="http://j2s.sourceforge.net/">Java2Script</a>
          <a href="http://www.j2js.com/">j2js</a>
          <a href="http://st-js.sourceforge.net/">Strongly-Typed JavaScript (STJS)</a>
        </td>
        <td class="yay">
          <a href="http://code.google.com/p/cibyl/">Cibyl (J2ME)</a>
          <a href="http://nestedvm.ibex.org/">NestedVM</a>
        </td>
        <td class="yay">
           <a href="http://www.beanshell.org/home.html">beanshell</a>
        </td>
        <td class="no">N/A</td> <!--Java via Ruby-->
        <td class="no">N/A</td> <!--Java via PHP-->
        <td class="no">N/A</td> <!--Java via Scala-->
        <td class="no">N/A</td> <!--Java via C#-->
        <td class="no">N/A</td> <!--Java via Clojure-->
        <td class="yay">
          <a href="http://jpype.sourceforge.net/">JPype</a>
          <a href="http://py4j.sourceforge.net/">Py4J</a>
        </td>
        <td class="no">N/A</td> <!--Java via Lua-->
        <td class="no">N/A</td> <!--Java via Haskell-->
        <td class="no">N/A</td> <!--Java via OCaml-->
      </tr>
      <tr>
        <th>Ruby</th>
        <td class="yay">
          <a href="http://opalrb.org">Opal</a>
          <a href="http://hotruby.yukoba.jp/">HotRuby</a>
          <a href="https://github.com/whitequark/coldruby">ColdRuby</a>
          <a href="http://rb2js.rubyforge.org/">rb2js</a>
          <a href="https://github.com/jessesielaff/red">Red</a>
          <a href="https://github.com/mattknox/8ball">8ball</a>
        </td>
        <td class="yay"><a href="http://rubyforge.org/projects/ruby2c/">ruby2c</a></td>
        <td class="yay">
          <a href="http://www.jruby.org" class="runtime">JRuby</a>
          <a href="https://github.com/headius/rubyflux">RubyFlux</a>
        </td> <!--Ruby via Java-->
        <td class="yay">
          <a href="http://rubini.us/">Rubinius</a>
        </td> <!--Ruby via Ruby-->
        <td class="yay"><a href="http://php.rubyforge.org/">PHP.rb</a></td>
        <td class="no">N/A</td> <!--Ruby via Scala-->
        <td class="yay">
          <a href="http://ironruby.net/">IronRuby</a>
        </td> <!--Ruby via C#-->
        <td class="no">N/A</td> <!--Ruby via Clojure-->
        <td class="yay">
          <a href="https://github.com/whymirror/unholy.git">UNHOLY</a>
        </td>
        <td class="no">N/A</td> <!--Ruby via Lua-->
        <td class="no">N/A</td> <!--Ruby via Haskell-->
        <td class="no">N/A</td> <!--Ruby via OCaml-->
      </tr>
      <tr>
        <th>PHP</th>
        <td class="yay">
          <a href="http://phpjs.hertzen.com/">php.js</a>
        </td>
        <td class="yay">
          <a href="https://github.com/facebook/hiphop-php">HipHop Compiler</a>
        </td>
        <td class="yay"><a href="http://www.caucho.com/resin-3.1/doc/quercus.xtp">Quercus</a></td>
        <td class="no">N/A</td> <!--PHP via Ruby-->
        <td class="yay"><a href="https://github.com/ircmaxell/PHPPHP">PHPPHP</a></td>
        <td class="no">N/A</td> <!--PHP via Scala-->
        <td class="no">N/A</td> <!--PHP via C#-->
        <td class="no">N/A</td> <!--PHP via Clojure-->
        <td class="yay"><a href="http://code.google.com/p/phppython/">phppython</a></td>
        <td class="no">N/A</td> <!--PHP via Lua-->
        <td class="no">N/A</td> <!--PHP via Haskell-->
        <td class="no">N/A</td> <!--PHP via OCaml-->
      </tr>
      <tr>
        <th>Scala</th>
        <td class="yay">
          <a href="http://scalagwt.github.com/">Scala+GWT</a>
          <a href="http://www.scala-js.org/">Scala.js</a>
          <a href="http://jscala.org/">JScala</a>
        </td>
        <td class="no">N/A</td> <!--Scala via C/C++-->
        <td class="no">N/A</td> <!--Scala via Java-->
        <td class="no">N/A</td> <!--Scala via Ruby-->
        <td class="no">N/A</td> <!--Scala via PHP-->
        <td class="yay"><a href="https://github.com/lihaoyi/Metascala">Metascala</a></td> <!--Scala via Scala-->
        <td class="no">N/A</td> <!--Scala via C#-->
        <td class="no">N/A</td> <!--Scala via Clojure-->
        <td class="no">N/A</td> <!--Scala via Python-->
        <td class="no">N/A</td> <!--Scala via Lua-->
        <td class="no">N/A</td> <!--Scala via Haskell-->
        <td class="no">N/A</td> <!--Scala via OCaml-->
      </tr>
      <tr>
        <th>C#</th>
        <td class="yay">
          <a href="http://www.saltarelle-compiler.com/">Saltarelle</a>
          <a href="http://sharpkit.net/">SharpKit (Commercial)</a>
          <a href="https://github.com/vannatech/blade">Blade</a>
          <a href="http://jsc.sourceforge.net/">jsc recompiler</a>
        </td>
        <td class="no">N/A</td> <!--C# via C/C++-->
        <td class="yay"><a href="http://jsc.sourceforge.net/">jsc recompiler</a></td>
        <td class="no">N/A</td> <!--C# via Ruby-->
        <td class="yay"><a href="http://jsc.sourceforge.net/">jsc recompiler</a></td>
        <td class="no">N/A</td> <!--C# via Scala-->
        <td class="yay"><a href="http://www.mono-project.com/CSharp_Compiler">Mono C#</a></td> <!--C# via C#-->
        <td class="no">N/A</td> <!--C# via Clojure-->
        <td class="no">N/A</td> <!--C# via Python-->
        <td class="no">N/A</td> <!--C# via Lua-->
        <td class="no">N/A</td> <!--C# via Haskell-->
        <td class="no">N/A</td> <!--C# via OCaml-->
      </tr>
      <tr>
        <th>Clojure</th>
        <td class="yay"><a href="https://github.com/clojure/clojurescript">ClojureScript</a></td>
        <td class="yay">
          <a href="https://github.com/schani/clojurec">ClojureC</a>
          <a href="http://nakkaya.com/2011/06/29/ferret-an-experimental-clojure-compiler/">Ferret</a>
        </td>
        <td class="yay"><a href="http://clojure.org">Clojure</a></td>
        <td class="yay"><a href="https://github.com/unnali/rouge.git">rouge</a></td>
        <td class="yay"><a href="https://github.com/rodnaph/clj-php">clj-php</a></td>
        <td class="yay"><a href="http://clojure.org">Clojure</a></td>
        <td class="yay"><a href="https://github.com/richhickey/clojure-clr">clojure-clr</a></td>
        <td class="yay"><a href="https://github.com/Bronsa/CinC">CinC</a></td> <!--Clojure via Clojure-->
        <td class="yay"><a href="https://github.com/halgari/clojure-py.git">clojure-py</a></td>
        <td class="yay"><a href="https://github.com/raph-amiard/clojurescript-lua.git">clojurescript-lua</a></td>
        <td class="no">N/A</td> <!--Clojure via Haskell-->
        <td class="no">N/A</td> <!--Clojure via OCaml-->
      </tr>
      <tr>
        <th>Python</th>
        <td class="yay">
          <a href="http://pyjaco.org/demo">Pyjaco</a>
          <a href="https://github.com/anandology/pyjs">pyjs</a>
          <a href="http://www.skulpt.org/">Skulpt</a>
          <a href="https://github.com/p2k/PyCow">PyCow</a>
          <a href="http://brython.info/index_en.html">Brython</a>
          <a href="https://pypi.python.org/pypi/pythonium/0.4.5">Pythonium</a>
          <a href="https://github.com/andrewschaaf/pyxc-pj">PyXC-PJ</a>
          <a href="https://github.com/DenerosArmy/pythonscript">PythonScript</a>
          <a href="http://pyjs.org/">PyJS (formerly Pyjamas)</a>
        </td> <!--Python via JS-->
        <td class="yay">
          <a href="http://nuitka.net/">Nuitka</a>
          <a href="http://code.google.com/p/shedskin/">shedskin</a>
          <a href="https://github.com/pradyun/Py2C">Py2C</a>
        </td><!--Python via C-->
        <td class="yay">
          <a href="http://www.jython.org/">Jython</a>
        </td><!--Python via Java-->
        <td class="yay">
          <a href="http://github.com/vic/typhon">Typhon</a>
        </td> <!--Python via Ruby-->
        <td class="no">N/A</td> <!--Python via PHP-->
        <td class="no">N/A</td> <!--Python via Scala-->
        <td class="yay">
          <a href="http://ironpython.net/">IronPython</a>
          <a href="http://pythonnet.sourceforge.net/">Python for .NET</a>
        </td> <!--Python via C# -->
        <td class="no">N/A</td> <!--Python via Clojure-->
        <td class="yay"><a href="http://pypy.org/">PyPy</a></td> <!--Python via Python-->
        <td class="no">N/A</td> <!--Python via Lua-->
        <td class="yay">
          <a href="https://github.com/bjpop/berp/wiki">Berp</a>
        </td><!--Python via Haskell-->
        <td class="no">N/A</td> <!--Python via OCaml-->
      </tr>
      <tr>
        <th>Lua</th>
        <td class="yay">
          <a href="https://github.com/mherkender/lua.js">lua2js</a>
          <a href="https://github.com/humbletim/ljs" class="runtime">ljs</a>
          <a href="http://kripken.github.io/lua.vm.js/lua.vm.js.html">lua.vm.js</a>
        </td>
        <td class="no">N/A</td> <!--Lua via C/C++-->
        <td class="yay"><a href="http://luaj.org/">luaj</a></td>
        <td class="no">N/A</td> <!--Lua via Ruby-->
        <td class="no">N/A</td> <!--Lua via PHP-->
        <td class="no">N/A</td> <!--Lua via Scala-->
        <td class="no">N/A</td> <!--Lua via C#-->
        <td class="no">N/A</td> <!--Lua via Clojure-->
        <td class="no">N/A</td> <!--Lua via Python-->
        <td class="yay"><a href="http://metalua.luaforge.net/">Metalua</a></td> <!--Lua via Lua-->
        <td class="no">N/A</td> <!--Lua via Haskell-->
        <td class="no">N/A</td> <!--Lua via OCaml-->
      </tr>
      <tr>
        <th>Haskell</th>
        <td class="yay">
          <a href="http://fay-lang.org">Fay</a>
          <a href="https://github.com/ghcjs/ghcjs">GHCJS</a>
          <a href="http://uu-computerscience.github.com/uhc-js/">UHCJS</a>
          <a href="http://www.haskell.org/haskellwiki/Yhc/Javascript">YCR2JS</a>
        </td>
        <td class="yay">
          <a href="http://repetae.net/computer/jhc/">JHC</a>
        </td>
        <td class="yay">
          <a href="http://www.cs.uu.nl/wiki/bin/view/Ehc/UhcJazyDocumentation">Jazy</a>
          <a href="https://github.com/Frege/frege">Frege</a>
        </td>
        <td class="no">N/A</td> <!--Haskell via PHP-->
        <td class="no">N/A</td> <!--Haskell via Scala-->
        <td class="no">N/A</td> <!--Haskell via C#-->
        <td class="no">N/A</td> <!--Haskell via Clojure-->
        <td class="no">N/A</td> <!--Haskell via Python-->
        <td class="yay">
          <a href="http://www.haskell.org/haskellwiki/Yhc/Pyhi" class="runtime">Pyhi</a>
        </td>
        <td class="no">N/A</td> <!--Haskell via Lua-->
        <td class="yay"><a href="http://www.haskell.org/nhc98/">nhc98</a></td <!--Haskell via Haskell-->
        <td class="no">N/A</td> <!--Haskell via OCaml-->
      </tr>
      <tr>
        <th>OCaml</th>
        <td class="yay">
          <a href="http://ocsigen.org/js_of_ocaml/">JS_of_ocaml</a>
        </td>
        <td class="yay">
          <a href="https://github.com/ocaml-bytes/ocamlcc">OCamlCC</a>
        </td>
        <td class="yay">
          <a href="http://ocamljava.x9c.fr/">OCaml-Java</a>
        </td> <!--OCaml via Java-->
        <td class="no">N/A</td> <!--OCaml via Ruby-->
        <td class="no">N/A</td> <!--OCaml via PHP-->
        <td class="no">N/A</td> <!--OCaml via Scala-->
        <td class="no">N/A</td> <!--OCaml via C#-->
        <td class="no">N/A</td> <!--OCaml via Clojure-->
        <td class="no">N/A</td> <!--OCaml via Python-->
        <td class="no">N/A</td> <!--OCaml via Lua-->
        <td class="no">N/A</td> <!--OCaml via Haskell-->
        <td class="no">N/A</td> <!--OCaml via OCaml-->
      </tr>
    </table>
  </div>

  <script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-37318032-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
  <script src="http://code.jquery.com/jquery.js"></script>
  <script>

function range (a, b) {
  return Array(b - a + 1).join(' ').split('').map(function (_, i) {
    return i + a;
  });
}

function randomize (a) {
  return a.slice().sort(function () { return Math.random() < 0.5 ? 1 : -1; });
}

$(function () {
  $('#matrix').on('mousemove', 'td, th', function (e) {
    $('.hover').removeClass('hover');
    var $tr = $(this).parent();
    $tr.filter(':not(.heading)').addClass('hover');
    $tr.siblings(':not(.first-heading)').add($tr)
      .find('*:nth-child(' + ($(this).index() + 1) + ')').addClass('hover');
  });

  // The fun game at the top.

  var tds = $('#matrix td'), width = Math.floor(Math.sqrt(tds.length));
  tds = tds.toArray().map(function (t) {
    return $(t).find('a').toArray().map(function (a) {
      return $(a);
    });
  });
  $('#myideaoffun').on('mouseover', function () {
    $('#myideaoffun').addClass('hover');
  })
  $('#myideaoffun').on('mouseout', function () {
    $('#myideaoffun').removeClass('hover');
  })
  function newTrick () {
    if ($('#myideaoffun').hasClass('hover')) {
      return;
    }
    var idx = Math.floor(Math.random()*100);
    var t = tds[idx];
    if (!t.length) {
      return newTrick();
    }
    var links = [randomize(t)[0]];
    // Found random one, find next.
    while (true) {
      var rar = randomize(range(0, width))[0];
      var idx = (width * (idx % width)) + rar;
      var t2 = tds[idx];
      if (!t2.length) {
        return newTrick();
      }
      if (t2 == t) {
        // Don't be too obvious.
        if (links.length == 1 || (links.length < 3 && Math.random() < 0.5)) {
          continue;
        }

        $('#myideaoffun').html('&rArr; Try running ' + links.map(function ($a) {
          var pos = $a.parent().index();
          var $to = $a.parent().parent().siblings().eq(1).find('th');
          return '<a href="' + $a.prop('href') + '">' + $a.text() + '</a> (<i>' + $a.parent('').siblings().eq(0).text() + ' &rarr; ' + $to.eq(pos).text().replace('[1]', '') + '</i>)';
        }).join(' in ') + '!')
        return;
      } else {
        links.push(randomize(t2)[0]);
      }
    }
  }

  newTrick();
  setInterval(newTrick, 5*1000);
});

  </script>
</body>
</html>
